<?php
	session_start();
	require_once('../config.php');
	
	
	
	if(isset($_POST['submit'])){
		if($_POST['UserName'] == 'admin' && $_POST['Password']=='123'){
			$_SESSION['logon'] = true;
			$login_OK = true;
			
			if(!isset($_GET['url']))
				$_GET['url'] ='index';

			header("Location: ". $config_basedir. "/WKSCP/{$_GET['url']}.php");
			exit();
		}
		else
		{
			$login_OK = false;
		}
	}
?>
<!DOCTYPE html>
<html>
<head>
    <title>WKS Control Panel - Log On</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="css/Site.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" media="screen" href="css/base.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="css/layout.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="css/login.css" />

</head>
<body>
    <div id="container" class="login-page">
        <div id="maincontent">
            <div class="content-login">
                <div class="loginform">
                    <div class="login-header">
                        <h2>WKS Control Panel</h2>
                    </div>
                    <div class="login-body">
						<?php 
							if(isset($login_OK)) 
								echo "<h2> Đăng nhập sai, hãy đăng nhập lại</h2>";
								
						?>
						<form action="login.php<?php if (isset($_GET['url'])){ echo "?url={$_GET['url']}"; }?>" method="post">                           
							<div>
                                <fieldset>
                                    <div class="editor-label">
                                        <label for="UserName">User name</label>
                                    </div>
                                    <div class="editor-field">
                                        <input  id="UserName" name="UserName" type="text" value="" />
                                    </div>
                                    <div class="editor-label">
                                        <label for="Password">Password</label>
                                    </div>
                                    <div class="editor-field">
                                        <input  id="Password" name="Password" type="password" />
                                    </div>
                                    <div class="editor-label">
                                        <input  name="RememberMe" type="checkbox" value="true" />
										<input name="RememberMe" type="hidden" value="false" />
                                        <label for="RememberMe">Remember me?</label>
                                    </div>
                                    <p>
                                        <input type="submit" name="submit" class="button pri login" value="Đăng nhập" />
                                    </p>
                                </fieldset>
                            </div>
						</form>                    
					</div>
                </div>
            </div>

        </div>
    </div>
</body>
</html>
